package spi.java;

import java.util.ServiceLoader;

/**
 * @Author: DRevelation
 * @Date: 2021/6/1 14:47
 */
public class JavaSpiDemo {
    public static void main(String[] args) {
        ServiceLoader<DemoService> serviceLoader = ServiceLoader.load(DemoService.class, Thread.currentThread().getContextClassLoader());
        for (DemoService demoService : serviceLoader) {
            System.out.println("===========class:" + demoService.getClass().getName() + "***" + demoService.sayHi("World"));
        }
    }
}
